/*
 * [文 件 名]:B5MThreadPool.java
 * [创 建 人]:allenwang
 * [创建时间]:Oct 22, 2013
 * [编　　码]:UTF-8
 * [版　　权]:Copyright © 2012 B5Msoft Co,Ltd. 
*/

package com.core.util;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 *	[简要描述]:
 *	[详细描述]:
 *	@author	[allenwang]
 *	@email	[allen.wang@b5m.com]
 *	@version	[版本号,Oct 22, 2013]
 *	@see		[B5MThreadPool]
 *	@package	[com.b5m.afw.internal]
 *	@since	[afw]
 */
public class B5MThreadPool
{
    private static ExecutorService executorService;
    private static ExecutorService singleExecutorService;

    public static void execute(Runnable runnable)
    {
        if (null == executorService)
        {
            executorService = Executors.newCachedThreadPool();
        }
        executorService.execute(runnable);
    }

    public static void executeSingle(Runnable runnable)
    {
        if (null == singleExecutorService)
        {
            singleExecutorService = Executors.newSingleThreadScheduledExecutor();
        }
        executorService.execute(runnable);
    }
}
